home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / asm_msc1.arc / PMODEDOC.ASM < prev    next >
Assembly Source File  |  1988-11-20  |  3KB  |  142 lines

  1.     name    pmode
  2.     page    55,80
  3.     title    'PMODE - set printing mode directly from DOS
  4. ;    
  5. ;    PMODE utility to set printing modes directly from DOS for LPT1
  6. ;
  7. ;    by    Chris Lindberg
  8. ;
  9. ;    Uncopyright 1982
  10. ;
  11. ;    Command syntax is 
  12. ;
  13. ;        A>pmode [c,c,c...]
  14. ;
  15. ;            and c is one or more characters
  16. ;            in upper or lower case
  17. ;            from the following list:
  18. ;
  19. ;            I = Italics on
  20. ;            C = Compressed on
  21. ;            E = Emphasized on
  22. ;            X = Expanded on
  23. ;            D = Double strike on
  24. ;
  25. ;            Pmode without any arguments resets the printer
  26. ;            to a cold start setting.
  27. ;
  28. ;        PMODE is a simple assembly language program that sends 
  29. ;        escape sequences to the printer for the various print
  30. ;        modes available.  This version is set up for the IBM
  31. ;        equivalents of the MX-80 and MX-100.  It should work as
  32. ;        well for the MX-80, MX-100 and other Epson models.  If
  33. ;        your printer uses other escape sequences, I've provided
  34. ;        the assembler listing so that you can make the necessary
  35. ;        changes.  If you don't have an assembler, you can use
  36. ;        DEBUG to change the program.  The escape sequences used
  37. ;        in this program are:
  38. ;
  39. ;                    CODES SENT
  40. ;        MODE        HEXADECIMAL        DECIMAL
  41. ;        ---------    -----------           -----------
  42. ;
  43. ;        Italics on      1b + 34        27 + 52
  44. ;        Compressed on      1b + 50        27 + 80
  45. ;        Expanded on      1b + 53        27 + 83
  46. ;        Emphasized on      1b + 45        27 + 69
  47. ;        Double strike on  1b + 47        27 + 71
  48. ;
  49. ;
  50. ;    The actual code segment star4s here:
  51. ;
  52.     input    equ    08h    ;command tail line buffer address
  53.     cr    equ    0dh    ;ASCII carraige return
  54. ;
  55.     cseg    segment    byte
  56.         assume    cs:cseg,ds:cseg
  57. ;
  58.         org    0100h    ;since this will be a .COM file
  59. ;
  60.     reset:    mov    al,0    ;reset the printer to a cold
  61.         mov    ah,1    ;start setting
  62.         mov    dx,0
  63.         int    17h
  64. ;
  65.         mov    si,offset input
  66.         cld        ;get address of command tail and...
  67.         lodsb        ;move it forward.  Check length
  68.         or     al,al    ;of buffer.  
  69.         jz    done     ;If zero, then we're done
  70. ;
  71.     read:    lodsb        ;get next byte of buffer
  72.         cmp    al,cr    ;Is it a CR?
  73.         je    done    ;if it is, then we're done
  74.         or    al,20h    ;otherwise, fold it to lower case
  75.         cmp    al,'a'  ;make sure it's between 'a'
  76.         jb    read
  77.         cmp    al,'z'    ;and 'z'
  78.         ja    read    ;otherwise, skip it.
  79. ;
  80.         cmp    al,'i'    ;Is it 'iú
  81.         jne    emph    ;if it isn't, go on
  82.         mov    al,1bh    ;send escape sequence...
  83.         call     print    ;...to printer
  84.         mov    al,34h    ;and send code for italics...
  85.         call     print    ;.... to printer
  86.         jmp    short read
  87. ;
  88.     emph:    cmp    al,'e'    ;is it 'e'?
  89.         jne    double
  90.         mov    al,1bh
  91.         call    print
  92.         mov    al,45h
  93.         call    print
  94.         jmp    short read
  95. ;
  96.     double:    cmp    al,'d'    ;is it 'd'?
  97.         jne    compr
  98.         mov    al,1bh
  99.         call    print
  100.         mov    al,47h
  101.         call    print
  102.         jmp    short read
  103. ;
  104.     compr:    cmp    al,'c'    ;is it a 'c'?
  105.         jne    expan    
  106.         mov    al,1bh
  107.         call    print
  108.         mov    al,50h
  109.         call    print
  110.         jmp    short read
  111. ;
  112.     expan:    cmp    al,'x'    ;is it a 'x'?
  113.         jne    read    
  114.         mov    al,1bh
  115.         call    print
  116.         mov    al,53h
  117.         call    print
  118.         jmp    sh/rt read
  119. ;
  120.     done:    int    20h    ;all done...return to DOS
  121. ;
  122.     print    proc    near    ;routine to send contents of 
  123.         push    dx    ;al to printer
  124.         mov    dx,0
  125.         mov    ah,0
  126.         int    17h
  127.         pop    dx
  128.         ret
  129.     print    endp
  130. ;
  131.     cseg    ends
  132. ;
  133. end contents of 
  134.         push    dx    ;al to printer
  135.         mov    dx,0
  136.         mov    ah,0
  137.         int    17h
  138.         pop    dx
  139.         ret
  140.     print    endp
  141. ;
  142.